<?php require_once('../Connections/sepolwan_connect.php'); ?>
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable sesi_nama set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && true) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "index.php?stat=login_heula";
if (!((isset($_SESSION['sesi_nama'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['sesi_nama'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) 
  $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_delprod = "-1";
if (isset($_GET['id'])) {
  $colname_delprod = $_GET['id'];
}
mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
$query_delprod = sprintf("SELECT * FROM gambargambar WHERE id = %s", GetSQLValueString($colname_delprod, "int"));
$delprod = mysql_query($query_delprod, $sepolwan_connect) or die(mysql_error());
$row_delprod = mysql_fetch_assoc($delprod);
$totalRows_delprod = mysql_num_rows($delprod);

if ((isset($_GET['id'])) && ($_GET['id'] != "")) {
  $deleteSQL = sprintf("DELETE FROM gambargambar WHERE id=%s",
                       GetSQLValueString($_GET['id'], "int"));

  mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
  $Result1 = mysql_query($deleteSQL, $sepolwan_connect) or die(mysql_error());

  $deleteGoTo = "imagefile.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
    $deleteGoTo .= $_SERVER['QUERY_STRING'];
  }
  if(file_exists('../images/gallery/gambargambar/'.$row_delprod['foto']))
unlink('../images/gallery/gambargambar/'.$row_delprod['foto']);
  header(sprintf("Location: %s", $deleteGoTo));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body {
	background:url(../images/bg.JPG);
}
body,button,input,select,textarea{font:12px/1.5 tahoma,arial,\5b8b\4f53; color: #333;}
input,select,textarea{font-size:100%;}
input,select{vertical-align:baseline;}
table{border-collapse:collapse;border-spacing:0;}
th{text-align:inherit;}
fieldset,img{border:0;}
iframe{display:block;}
abbr,acronym{border:0;font-variant:normal;}
del{text-decoration:line-through;}
address,caption,cite,code,dfn,em,th,var{font-style:normal;font-weight:500;}
caption,th{text-align:left;}
h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:500;}
q:before,q:after{content:'';}
sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}
sup{top:-0.5em;}
sub{bottom:-0.25em;}
a{color: #060;}
a:hover{text-decoration:none; color: #F00;}
ins,a{text-decoration:none;}
.btnews_bg {
background:url(../images/bg_news_bt.jpg);
height:44px;
border-right:1px solid #d2d2d2;
}
.txt14coklatbold {
font-family: big_noodle_titling,Verdana;
font-size: 18px;
color: #666;
line-height:1;
font-weight:bold;
}
.btnews_bg {
background:url(../images/bg_news_bt.jpg);
height:44px;
border-right:1px solid #d2d2d2;
}
#nama {
	width:200px;
	height:25px;
	border-style: none;
	padding:5px;
	margin:5px;
	background-color: #E8E8E8;
	-webkit-transition: All 0.5s ease;
-moz-transition: All 0.5s ease;
-o-transition: All 0.5s ease;
-ms-transition: All 0.5s ease;
transition: All 0.5s ease;
}
#nama:focus {
	background-color:#FFF;
	outline:none;
	width:200px;
	height:25px;
	padding:5px;
	margin:5px;
	box-shadow:0px 0px 3px #666666;
	-webkit-transition: All 0.5s ease;
-moz-transition: All 0.5s ease;
-o-transition: All 0.5s ease;
-ms-transition: All 0.5s ease;
transition: All 0.5s ease;
	
}
#masuk {
	background: #999;
	border-style:none;
	width:210px;
	height:30px;
	margin:5px;
	color:#FFF;
	font-weight:bold;
	-webkit-transition: All 0.5s ease;
-moz-transition: All 0.5s ease;
-o-transition: All 0.5s ease;
-ms-transition: All 0.5s ease;
transition: All 0.5s ease;
}
#masuk:hover {
	cursor:pointer;
	background: #F00;
	border-style:none;
	width:210px;
	height:30px;
	margin:5px;
	font-weight:bold;
	-webkit-transition: All 0.5s ease;
-moz-transition: All 0.5s ease;
-o-transition: All 0.5s ease;
-ms-transition: All 0.5s ease;
transition: All 0.5s ease;
}
</style>
</head>

<body>
</body>
</html>
<?php
mysql_free_result($delprod);
?>
